package com.example.xianzhi.dao.impl;

import com.example.xianzhi.dao.AddDao;
import com.example.xianzhi.entity.TbAdd;
import com.example.xianzhi.util.ORMUtil;

import java.util.List;

public class AddDaoImpl implements AddDao {
    @Override
    public List<TbAdd> selectAdd(int user_id) {
        String sql ="SELECT * FROM tb_add WHERE user_id=?";
        System.out.println(sql);
        List<TbAdd> selectAdd = new ORMUtil().selectList(TbAdd.class,sql,user_id);
        return selectAdd;
    }

    @Override
    public int insertAdd(TbAdd Adds) {
        String sql ="INSERT INTO tb_add(add_name,user_id,add_user_num,add_user_name) values(?,?,?,?)";
        int insertAdd = new ORMUtil().executeDML(sql,Adds.getAdd_name(),Adds.getUser_id(),Adds.getAdd_user_num(),Adds.getAdd_user_name());
        return insertAdd;
    }
}
